﻿/* 
 * TABLE: dbo.BooksByAuthor 
 */

/* 
 * TABLE: BooksByAuthor 
 */

CREATE TABLE BooksByAuthor(
    AuthorId    int    NOT NULL,
    BookId      int    NOT NULL,
    CONSTRAINT PK_BooksByAuthor PRIMARY KEY NONCLUSTERED (AuthorId, BookId)
)
GO
ALTER TABLE BooksByAuthor ADD CONSTRAINT FKBooks_BooksByAuthor 
    FOREIGN KEY (BookId)
    REFERENCES Books(BookId)
GO
/* 
 * TABLE: dbo.BooksByAuthor 
 */

/* 
 * TABLE: BooksByAuthor 
 */

ALTER TABLE BooksByAuthor ADD CONSTRAINT FKAuthors_BooksByAuthor 
    FOREIGN KEY (AuthorId)
    REFERENCES Authors(AuthorId)